#!/bin/sh
def_pro=1
RUNNING_PATH=$(dirname $0)
cd ${RUNNING_PATH}
echo "run path is ${RUNNING_PATH}"

DEAMON=updateHotTwitterCache.php
P_NUM=`ps -wef|grep ${DEAMON} |grep -v grep |wc -l`
diff=`expr $def_pro - $P_NUM`;
if [ $P_NUM -lt $def_pro ]; then
for ((i=0; i<$diff; i++));
do
nohup /opt/app/php5/bin/php -q ${DEAMON}&
done;
fi
